package com.warmguard.core.controlller;

import com.warmguard.core.core.vo.Result;
import com.warmguard.core.service.FileService;
import io.minio.GetPresignedObjectUrlArgs;
import io.minio.MinioClient;
import io.minio.PostPolicy;

import io.minio.errors.*;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.time.ZoneOffset;
import java.time.ZonedDateTime;
import java.util.*;

@RequestMapping("/member/file")
@RestController
public class FileUploadController {

    @Autowired
    private FileService fileService;


    @PostMapping("/upload")
    public Result<String> upload(@RequestParam MultipartFile file) throws Exception {
        String url = fileService.upload(file);
        return Result.ok(url);
    }


}
